package com.hgkx.service.impl;

import com.alibaba.fastjson.JSON;
import com.hgkx.domain.MessageBoard;
import com.hgkx.service.MessageBoardService;
import com.hgkx.util.FilePath;
import com.hgkx.util.FileUtil;
import org.springframework.stereotype.Service;

import java.io.File;
import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.UUID;

@Service
public class MessageBoardServiceImpl implements MessageBoardService {
    @Override
    public void saveMessageBoard(MessageBoard board){
        //SimpleDateFormat format=new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
        board.setDataTime(new Date());
        board.setId(UUID.randomUUID().toString());
        FileUtil.writeFile(FilePath.MESSAGEBOARD, JSON.toJSONString(board));
    }
}
